import { api } from "../assets/http/api.js";
let aMusic = new Audio();

aMusic.playMusic = (src) => {
    aMusic.src = src;
        aMusic.$vm.$axios(api.getWord + `${aMusic.$vm.$store._modules.root.state.resStore.nowplaymusic.id}`).then((res) => {
            aMusic.$vm.$store._modules.root.state.resStore.nowplaymusic.Word = res.data.lrc.lyric;
        })

    aMusic.oncanplay = () => {
        aMusic.$vm.$store._modules.root.state.resStore.nowplaymusic.duration = aMusic.duration
        aMusic.play();
    }
},
    aMusic.onpause = () => {
        console.log('音乐暂停')
    },
    aMusic.onplay = () => {
        console.log('音乐播放')
    }
aMusic.onended = () => {
    console.log('音乐播放完了')
    //默认单曲循环
}


















export default aMusic;
